#~/.tmux.conf

# unbind default prefix and set it to ctrl-a
unbind C-b 
set -g prefix C-x 
bind C-x send-prefix

# make delay shorter
set -sg escape-time 0


#### key bindings ####

# reload config file
bind r source-file ~/.tmux.conf \; display ".tmux.conf reloaded!"

# quickly open a new window
bind N new-window

# synchronize all panes in a window
bind y setw synchronize-panes

# pane movement shortcuts (same as vim)
bind h select-pane -L
bind j select-pane -D
bind k select-pane -U
bind l select-pane -R

# enable mouse support for switching panes/windows
#set -g mouse-utf8 on
set -g mouse on
set-option -g mouse on

#### copy mode : vim ####

# set vi mode for copy mode
setw -g mode-keys vi

# copy mode using 'Esc'
unbind [
bind Escape copy-mode

# start selection with 'space' and copy using 'y'
# 点击Ctrl+x Esc进入复印模式。然后按下，Space然后按vi移动键进行选择文本，然后按y复制
# tmux < 2.5
#bind -t vi-copy y copy-pipe 'xclip -in -selection clipboard'
# tmux >= 2.5
bind -T copy-mode-vi y send-keys -X copy-pipe-and-cancel 'xclip -in -selection clipboard'

# paste using 'p'
# 点击Ctrl+x p 粘贴
unbind p
bind p paste-buffer

# window
unbind '"'
bind 2 splitw -v -c '#{pane_current_path}' # 垂直方向新增面板，默认进入当前目录
unbind %
bind 3 splitw -h -c '#{pane_current_path}' # 水平方向新增面板，默认进入当前目录
bind -r ^k resizep -U 1 # 绑定Ctrl+k为往↑调整面板边缘10个单元格
bind -r ^j resizep -D 1 # 绑定Ctrl+j为往↓调整面板边缘10个单元格
bind -r ^h resizep -L 1 # 绑定Ctrl+h为往←调整面板边缘10个单元格
bind -r ^l resizep -R 1 # 绑定Ctrl+l为往→调整面板边缘10个单元格